home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 120
/
Vol 120.iso
/
games
/
titans
/
beastboy.swf
/
scripts
/
DefineSprite_252
/
frame_7
/
DoAction.as
Wrap
Text File
|
2010-11-09
|
3KB
|
179 lines
r.vy = 0;
onenterframe = function()
{
r.xs = 0;
if(r.canpress)
{
gojump = 0;
go = 0;
if(r.control == 1)
{
if(Key.isDown(32))
{
attac = 1;
}
else
{
if(Key.isDown(38))
{
gojump = 1;
}
if(Key.isDown(37))
{
go = 1;
}
else if(Key.isDown(39))
{
go = 2;
}
}
}
else
{
if(r._xmouse < 250)
{
go = 1;
}
else if(r._xmouse > 350)
{
go = 2;
}
if(clicked)
{
clicked = 0;
gojump = 1;
}
}
}
if(go == 1)
{
r.xs = - r.runspeed;
}
else if(go == 2)
{
r.xs = r.runspeed;
}
if(gojump)
{
if(r.canjump and !r.jump)
{
r.vy = r.jumpforce;
r.jump = 1;
r.canjump = 0;
r.onfloat = 0;
}
}
r.nx = p._x + r.xs;
r.ny = p._y;
if(r.nx < r.xmin)
{
r.nx = r.xmin;
}
else if(r.nx > r.xmax)
{
r.nx = r.xmax;
}
if(r.ny < r.ymin)
{
r.ny = r.ymin;
}
else if(r.ny > r.ymax)
{
r.ny = r.ymax;
}
r.x1 = r.nx - r.pw;
r.x2 = r.nx + r.pw;
r.y1 = r.ny - r.ph;
r.y2 = r.ny;
cekstep();
if(r.xs > 0)
{
r.hd = 1;
cekright(r.pbumper[r.pnow]);
}
else if(r.xs < 0)
{
r.hd = 2;
cekleft(r.pbumper[r.pnow]);
}
if(r.jump)
{
r.vy += r.grav / 10;
if(r.vy < 0)
{
up = cekup();
}
else
{
down = cekdown();
}
}
if(r.jump)
{
r.ny = p._y + r.vy / 10;
if(r.vy < 0)
{
if(r.ny - r.ph < up)
{
r.ny = up + r.ph + 0.1;
r.jump = 1;
r.vy = 0;
}
}
else if(r.ny > down)
{
if(r.floatbelow != 0)
{
r.onfloat = r.floatbelow;
}
r.ny = down;
r.jump = 0;
r.vy = 0;
r.canjump = 1;
}
}
p._x = r.nx;
p._y = r.ny;
if(r.jump)
{
r.sta = "jump";
}
else if(r.xs != 0)
{
r.sta = "run";
}
else
{
r.sta = "stand";
}
p.gotoAndStop(r.sta + r.hd);
if(r.hit)
{
if(!r.inv)
{
gotoAndPlay(38);
}
else
{
r.hit = 0;
}
}
else if(r.monitor)
{
gotoAndPlay(17);
}
else if(r.onlift)
{
gotoAndPlay(25);
}
else if(r.mmlift)
{
gotoAndPlay(30);
}
};
onmousedown = function()
{
clicked = 1;
};
stop();